//
//  MineCarRideDataView.m
//  Cycling
//
//  Created by chijianguo on 2023/3/12.
//

#import "MineCarRideDataView.h"

@implementation MineCarRideDataView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = COLOR_WHITE;
        [self setupUI];
    }
    return self;
}

- (void)setupUI {

    
    self.carNameLB = [[UILabel alloc] init];
    self.carNameLB.font = FONT_SECONDARY_TITLE;
    self.carNameLB.textColor = COLOR_BLACK;
    self.carNameLB.text = @"bike01";
    [self addSubview:self.carNameLB];
    [self.carNameLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(MARGIN_MAX);
        make.top.equalTo(self).offset(MARGIN_MIDDLE);
        make.height.mas_equalTo(20);
    }];
    
    self.totalMileTitleLB = [[UILabel alloc] init];
    self.totalMileTitleLB.font = FONT_BODY_15;
    self.totalMileTitleLB.textColor = COLOR_SIMPLEBLACK;
    self.totalMileTitleLB.numberOfLines = 0;
    self.totalMileTitleLB.text = @"骑行总里程(km)";
    [self addSubview:self.totalMileTitleLB];
    [self.totalMileTitleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(MARGIN_MAX);
        make.top.equalTo(self.carNameLB.mas_bottom).offset(MARGIN_MIDDLE);
        make.height.mas_equalTo(50);
        make.width.mas_equalTo(80);
    }];
    
    self.totalMileNumLB = [[UILabel alloc] init];
    self.totalMileNumLB.font = FONT_MEDIUM_28;
    self.totalMileNumLB.textColor = COLOR_BLACK;
    self.totalMileNumLB.text = @"0.00";
    [self addSubview:self.totalMileNumLB];
    [self.totalMileNumLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(MARGIN_MAX);
        make.top.equalTo(self.totalMileTitleLB.mas_bottom).offset(MARGIN_MIDDLE);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(80);
    }];


    self.leftMileTitleLB = [[UILabel alloc] init];
    self.leftMileTitleLB.font = FONT_BODY_15;
    self.leftMileTitleLB.textColor = COLOR_SIMPLEBLACK;
    self.leftMileTitleLB.numberOfLines = 0;
    self.leftMileTitleLB.text = @"剩余里程(km)";
    [self addSubview:self.leftMileTitleLB];
    [self.leftMileTitleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.totalMileTitleLB.mas_right).offset(MARGIN_MIDDLE);
        make.top.equalTo(self.carNameLB.mas_bottom).offset(MARGIN_MIDDLE);
        make.height.mas_equalTo(50);
        make.width.mas_equalTo(80);
    }];

    self.leftMileNumLB = [[UILabel alloc] init];
    self.leftMileNumLB.font = FONT_MEDIUM_28;
    self.leftMileNumLB.textColor = COLOR_BLACK;
    self.leftMileNumLB.text = @"0.00";
    [self addSubview:self.leftMileNumLB];
    [self.leftMileNumLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.totalMileTitleLB.mas_right).offset(MARGIN_MIDDLE);
        make.top.equalTo(self.leftMileTitleLB.mas_bottom).offset(MARGIN_MIDDLE);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(80);
    }];

    self.singleMileTitleLB = [[UILabel alloc] init];
    self.singleMileTitleLB.font = FONT_BODY_15;
    self.singleMileTitleLB.textColor = COLOR_SIMPLEBLACK;
    self.singleMileTitleLB.numberOfLines = 0;
    self.singleMileTitleLB.text = @"最长单次骑行(km)";
    [self addSubview:self.singleMileTitleLB];
    [self.singleMileTitleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftMileTitleLB.mas_right).offset(MARGIN_MIDDLE);
        make.top.equalTo(self.carNameLB.mas_bottom).offset(MARGIN_MIDDLE);
        make.height.mas_equalTo(50);
        make.width.mas_equalTo(80);
    }];

    self.singleMileNumLB = [[UILabel alloc] init];
    self.singleMileNumLB.font = FONT_MEDIUM_28;
    self.singleMileNumLB.textColor = COLOR_BLACK;
    self.singleMileNumLB.text = @"0.00";
    [self addSubview:self.singleMileNumLB];
    [self.singleMileNumLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftMileTitleLB.mas_right).offset(MARGIN_MIDDLE);
        make.top.equalTo(self.singleMileTitleLB.mas_bottom).offset(MARGIN_MIDDLE);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(80);
    }];

}
@end
